const userService = require('../services/userService');

const getUser = async (req, res) => {
  try {
    const user = await userService.getUserById(req.params.id);
    res.json(user);
  } catch (error) {
    res.status(500).send(error.message);
  }
};

const createUser = async (req, res) => {
  try {
    const user = await userService.createUser(req.body);
    res.status(200).json(user);
  } catch (error) {
    res.status(500).send(error.errors);
  }
};

module.exports = {
  getUser,
  createUser,
};
